<extend name="Public/base" />
<block name="style">
<link rel="stylesheet" href="__STATIC__/jquery-ui/css/jquery-ui.min.css"
	type="text/css" media="screen" />
<link rel="stylesheet"
	href="__STATIC__/plupload/js/jquery.ui.plupload/css/jquery.ui.plupload.css"
	type="text/css" media="screen" />
<script type="text/javascript"
	src="__STATIC__/jquery-ui/js/jquery-ui.min.js"></script> <script
	type="text/javascript"
	src="__STATIC__/plupload/js/plupload.full.min.js"></script> <script
	type="text/javascript"
	src="__STATIC__/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js"></script>
<script type="text/javascript"
	src="__STATIC__/plupload/js/i18n/zh_CN.js"></script> <script
	type="text/javascript"
	src="__STATIC__/lhgdialog/lhgdialog.min.js?self=true&skin=blue"></script></block>
<block name="body"> <!-- 标题栏 -->

<div class="main-title">
	<h2>新增图表</h2>
</div>

<form action="{:U()}" method="post" class="form-horizontal">
	<div class="form-item">
		<div id="uploader" style="width: 90%;">
			<p>您的浏览器没有 Flash, Silverlight 或 HTML5 支持。</p>
		</div>
	</div>
	<div class="form-item">
		<button class="btn submit-btn ajax-post" id="submit" type="submit"
			target-form="form-horizontal">开始上传</button>
		<button class="btn btn-return"
			onclick="javascript:history.back(-1);return false;">返回上级</button>
	</div>
</form>
</block>

<block name="script"> <script type="text/javascript">
	+function($) {
		$("#uploader").plupload({
			buttons : {
				browse : true,
				start : false,
				stop : true
			},
			// General settings
			runtimes : 'html5,flash,silverlight,html4',
			url : "{:U('upload?question='.$question)}",

			//multiple_queues : false,
			// User can upload no more then 20 files in one go (sets multiple_queues to false)
			max_file_count : 0,

			chunk_size : '1mb',

			// Resize images on clientside if we can
			/*resize : {
				width : 200,
				height : 200,
				quality : 90,
				crop : true
			// crop to exact dimensions
			},
			 */

			filters : {

				prevent_duplicates : true,
				// Maximum file size
				max_file_size : '1000mb',
				// Specify what files to browse for
				mime_types : [ {
					title : "Image files",
					extensions : "jpg,gif,png"
				} ]
			},

			// Rename files by clicking on their titles
			rename : false,

			// Sort files
			sortable : true,

			// Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
			dragdrop : true,

			unique_names : true,

			// Views to activate
			views : {
				list : true,
				thumbs : true, // Show thumbs
				active : 'thumbs'
			},

			// Flash settings
			flash_swf_url : '__STATIC__/plupload/js/Moxie.swf',

			// Silverlight settings
			silverlight_xap_url : '__STATIC__/plupload/js/Moxie.xap'

		});

		$("#uploader").on('complete', function() {
			$.dialog.tips('上传完成，页面将跳转！');
			window.location.href = "{:U('index',array('id'=>$question))}";
		});

		$('#submit').click(function() {
			if ($("#uploader").plupload('getFiles').length == 0) {
				return false;
			} else {
				$('#uploader').plupload('start');
			}
		});

	}(jQuery);
</script> </block>
